<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>支付中....</title>
    <style>
        body { font-family: Arial, sans-serif; }
        .success-page { text-align: center; padding: 50px; }
        .success-page h1 { color: #2ecc71; }
        .order-info { margin-top: 20px; }
        .action-buttons { margin-top: 40px; }
        .action-buttons a { margin: 0 10px; }
    </style>
</head>
<body>
<div class="success-page">
    <h1 id="order_id" > 支付中.... </h1>

    <div class="action-buttons" style="display: none">
        <h1 class="action-buttons"  > 支付完成 </h1>
        <button class="action-buttons" style="color: #0a6aa1" > 返回首页 </button>
    </div>
</div>
</body>

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>

    let  o='{$order_id}';
    // 定义发送AJAX请求的函数
    const url = 'https://www.kdh8.vip/api/Home/payOrderId?order_id=' + o;
    // 定义发送AJAX请求的函数
    function sendRequest() {
        fetch(url)
            .then(response => response.json()) // 如果返回的是JSON数据
            .then(data => {
                console.log( data ); // 处理返回的数据
                if(data['code'] == 200){
                    $('#order_id').hide();
                    $('.action-buttons').show()
                    clearInterval(time);
                }
            })
            .catch(error => console.error('请求发生错误:', error));
    }
    // 设置定时器，每隔一定时间发送请求
    // 这里设置为每5秒发送一次请求
  var time =  setInterval(sendRequest, 5000);

$(document).ready(function() {
    $('.action-buttons').on('click', function() {
        window.close();
    });
});

</script>

</html>